﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfApplication2.ViewModels.Afiliado;
using WpfApplication2.SindicatoWebService;

namespace WpfApplication2.Views.HistoriaClinica
{
    /// <summary>
    /// Interaction logic for EditarHistoria.xaml
    /// </summary>
    public partial class EditarHistoria : Page
    {
        #region Propiedades

        private EditarHistoriaViewModel contexto
        {
            get
            {
                return (EditarHistoriaViewModel)DataContext;
            }
        }

        #endregion

        public EditarHistoria(Instancias instancias, AfiliadoDTO afiliado, HistoriaClinicaDTO historia)
        {
            InitializeComponent(); 
            DataContext = new EditarHistoriaViewModel(instancias, afiliado, historia);

        }

        private void btnBorrarEvolucion_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var boton = sender as Image;
            var canvas = boton.Parent as Canvas;
            var evolucion = contexto.EvolucionesCollection.Where(x => x.Id == Convert.ToInt32(boton.Tag)).First();
            evolucion.Id = 0;
            canvas.Visibility = Visibility.Collapsed;
        }
    }
}
